package cn.com.travelman.service.push.factory.getui;

import java.util.ArrayList;
import java.util.List;

import cn.com.travelman.service.push.bean.PushLinkMessage;
import cn.com.travelman.service.push.bean.PushNotificationMessage;
import cn.com.travelman.service.push.bean.PushTransmissionMessage;

import com.gexin.rp.sdk.template.LinkTemplate;
import com.gexin.rp.sdk.template.NotificationTemplate;
import com.gexin.rp.sdk.template.TransmissionTemplate;

public class PushMessage {
    public String master;
    public List<String> cidList;
    public String cid;
    public String host;
    //
    public LinkTemplate initTemplate(PushLinkMessage content) {
        LinkTemplate template = new LinkTemplate();
        // 设置APPID与APPKEY
        template.setAppId(content.getAppId());
        template.setAppkey(content.getAppKey());
        // 设置通知栏标题与内容
        template.setTitle(content.getTitle());
        template.setText(content.getTitle());
        // 配置通知栏图标
        template.setLogo(content.getLogo());
        // 配置通知栏网络图标
        template.setLogoUrl(content.getLogoUrl());
        // 设置通知是否响铃，震动，或者可清除
        template.setIsRing(content.isRing());
        template.setIsVibrate(content.isVibrate());
        template.setIsClearable(content.isClearable());
        // 设置打开的网址地址
        template.setUrl(content.getUrl());
        return template;
    }

	public NotificationTemplate initTemplate(PushNotificationMessage content) {
    	NotificationTemplate template = new NotificationTemplate();
        // 设置APPID与APPKEY
        template.setAppId(content.getAppId());
        template.setAppkey(content.getAppKey());
        // 设置通知栏标题与内容
        template.setTitle(content.getTitle());
        template.setText(content.getTitle());
        // 配置通知栏图标
        template.setLogo(content.getLogo());
        // 配置通知栏网络图标
        template.setLogoUrl(content.getLogoUrl());
        // 设置通知是否响铃，震动，或者可清除
        template.setIsRing(content.isRing());
        template.setIsVibrate(content.isVibrate());
        template.setIsClearable(content.isClearable());
        // 设置打开的网址地址
        template.setLogoUrl(content.getLogoUrl());
        // 设置透传类型
        template.setTransmissionType(content.getTransmissionType());
        // 设置透传内容
        template.setTransmissionContent(content.getTransmissionContent());

        return template;
    }
	
    public TransmissionTemplate initTemplate(PushTransmissionMessage content) {
    	TransmissionTemplate template = new TransmissionTemplate();
        // 设置APPID与APPKEY
        template.setAppId(content.getAppId());
        template.setAppkey(content.getAppKey());
        // 设置透传类型
        template.setTransmissionType(content.getTransmissionType());
        // 设置透传内容
        template.setTransmissionContent(content.getTransmissionContent());

        return template;
    }
    
    public String getMaster() {
		return master;
	}
	public void setMaster(String master) {
		this.master = master;
	}
	public List<String> getCidList() {
		if (cidList == null){
			cidList= new ArrayList<String>();
		}
		return cidList;
	}
	public void setCidList(List<String> cidList) {
		this.cidList = cidList;
	}
	public String getCid() {
		return cid;
	}
	public void setCid(String cid) {
		this.cid = cid;
	}
	public String getHost() {
		return host;
	}
	public void setHost(String host) {
		this.host = host;
	}
}
